<?php


namespace App\Service;

use App\Constants\XZXResponseCode;
use App\Utils\CustomUtils;
use Hyperf\Utils\Arr;

/**
 * Class RiskParamService
 * 风控参数
 *
 * @package App\Service
 */
class RiskParamService {

    public function list (array $params) {

        $map = config("risk.param", []);

        $list = [];
        foreach ($map as $k => $v) {
            array_push($list, [
                'value'  => $k,
                'label' => $v,
            ]);
        }

        $total = count($list);

        $data = [
            'total' => $total,
            'list' => $list,
        ];

        return CustomUtils::xeServiceReturnData(XZXResponseCode::SUCCESS_CODE,XZXResponseCode::getMessage(XZXResponseCode::SUCCESS_CODE),$data);
    }

    public function options (array $params) {

        $data = $this->list($params)['data']['list'];

        return CustomUtils::buildSuccess($data);
    }
}
